
<template>
  <div>
    <el-table :data="tableData" style="width: 100%">
      <el-table-column label="标题" width="180">
        <template slot-scope="scope">
          <span v-html="scope.row.contentTitle" style="margin-left: 10px"></span>
        </template>
      </el-table-column>
      <el-table-column label="内容" width="180">
        <template slot-scope="scope">
          <span style="margin-left: 10px">{{ scope.row.content }}</span>
        </template>
      </el-table-column>
      <el-table-column label="图片" width="180">
        <template slot-scope="scope">
          <img :src="scope.row.picture" style="width: 100px;height: 100px;margin-left: 10px">
        </template>
      </el-table-column>
      <el-table-column label="创建人" width="180">
        <template slot-scope="scope">
          <span style="margin-left: 10px">{{ scope.row.username }}</span>
        </template>
      </el-table-column>
      <el-table-column label="创建时间" width="180">
        <template slot-scope="scope">
          <span style="margin-left: 10px">{{ scope.row.creationTime }}</span>
        </template>
      </el-table-column>

      <el-table-column label="收藏数量" width="180">
        <template slot-scope="scope">
          <span style="margin-left: 10px">{{ scope.row.collect }}</span>
        </template>
      </el-table-column>
      <el-table-column label="评论数量" width="180">
        <template slot-scope="scope">
          <span style="margin-left: 10px">{{ scope.row.review }}</span>
        </template>
      </el-table-column>
      <el-table-column label="操作">
        <template slot-scope="scope">
          <el-button type="success" size="mini" @click="handleEdit(scope.row.contentId)">查 看</el-button>
        </template>
      </el-table-column>
    </el-table>
  </div>
</template>

<script>
  //这里可以导入其他文件(比如:组件,工具js,第三方插件js,json文件,图片文件等等)
  //例如:import <组件名称> from '<组件路径>'================================================================================

  //主
  import {getInfo} from "@/api/login";
  import {myCollection, personalPublishingList} from "@/api/system/patients";

  export default {

    //import引入的组件需要注入到对象中才能使用=================================================================================
    components: {},
    props: {},
    data() {
      //这里存放数据======================================================================================================
      return {
        tableData:{},
        user:{}
      };
    },
    //计算属性 类似于data概念
    computed: {},
    //监控data中的数据变化
    watch: {},
    //方法集合===========================================================================================================
    methods: {
      userList(){
        getInfo().then(res => {
          this.user = res.data.user
        })
      },
      personal(){
        setTimeout(() => {
          personalPublishingList(this.user.userId).then(res => {
            this.tableData = res.data
          })
        }, 800);

      }
    },
    //生命周期 - 创建完成(可以访问当前this实例)
    created() {
      this.userList();
      this.personal();
    },
    //生命周期 - 挂载完成(可以访问DOM元素)
    mounted() {
    },
    beforeCreate() {
    }, //生命周期 - 创建之前
    beforeMount() {
    }, //生命周期 - 挂载之前
    beforeUpdate() {
    }, //生命周期 - 更新之前
    updated() {
    }, //生命周期 - 更新之后
    beforeDestroy() {
    }, //生命周期 - 销毁之前
    destroyed() {
    }, //生命周期 - 销毁完成
    activated() {
    } //如果页面有keep-alive缓存功能,这个函数会触发
  };
</script>
<style scoped>

</style>

